<template>
  <div class="variety" :style="defaultHeight">
    <MainTop>
      <span slot="title">{{ name }}</span>
      <p slot="content">{{ content }}</p>
    </MainTop>
    <div class="centent">
        <tables-global></tables-global>
    </div>
  </div>
</template>

<script>
import MainTop from "@/components/mainTop.vue";
import tablesGlobal from "@/components/CommonVariety/tables_global.vue";
export default {
  name: "variety",
  components: {
    MainTop,
    tablesGlobal,
  },
  data() {
    return {
      name: "菜品",
      content: "菜品数据",
      defaultHeight: {
        height: "",
      },
    };
  },

  methods: {
    //定义方法，获取高度减去头尾
    getHeight() {
      this.defaultHeight.height = window.innerHeight - 100 + "px";
    },

  },

  created() {
    //页面创建时执行一次getHeight进行赋值，顺道绑定resize事件
    window.addEventListener("resize", this.getHeight);
    this.getHeight();
  },
};
</script>

<style lang="less" scoped>
.variety {
  width: 100%;
  background-color: #f0f2f5;
}
.title {
  padding: 30px;
  background-color: #fff;
  span {
    font-size: 28px;
    font-weight: 800 !important;
  }
}
.centent {
  height: auto;
  margin: 35px;
  padding: 30px;
  background-color: #fff;
}
</style>
